Re-exports

pub use semantic_analysis::namespace;
pub use semantic_analysis::TypedDeclaration;
pub use crate::parse_tree::Declaration;
pub use error::CompileError;
pub use error::CompileResult;
pub use error::CompileWarning;
pub use crate::parse_tree::*;

Modules

Configurable yet nonchanging constants for the compiler.

Tools related to handling/recovering from Sway compile errors and reporting them to the user.

Contains all the code related to parsing Sway source code.

Type checking for Sway.

Structs

Configuration for the overall build and compilation process.

Represents a parsed, but not yet type checked, Expression.

The set of items that represent the namespace context passed throughout type checking.

A module and its submodules in the form of a tree.

A parsed, but not yet type-checked, Sway program.

A UseStatement is a statement that imports something from a module into the local namespace.

Enums

Represents the result of compiling Sway code via compile_to_bytecode. Contains the compiled bytecode in byte form, or resulting errors, and any warnings generated.

Represents the result of compiling Sway code via compile_to_asm. Contains the compiled assets or resulting errors, and any warnings generated.

A Sway program can be either a contract, script, predicate, or a library.

Type information without an associated value, used for type inferencing and definition.

Functions

Given a CompilationResult containing the assembly (opcodes), compile to a BytecodeCompilationResult which contains the asm in bytecode form.

Given an AST compilation result, compile to a CompilationResult which contains the asm in opcode form (not raw bytes/bytecode).

Given input Sway source code, compile to a CompilationResult which contains the asm in opcode form (not raw bytes/bytecode).

Given input Sway source code, compile to a BytecodeCompilationResult which contains the asm in bytecode form.

Given an input Arc<str> and an optional BuildConfig, parse the input into a [SwayParseTree].